package com.frxuexi.lib_base.room

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
@Dao
interface AskDao {
    //申请请假
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(askLeave: AskLeave):Long

    @Update
    fun update(askLeave: AskLeave):Int

    @Delete
    fun delete(askLeave: AskLeave)

    @Query("select * from ask where uid=:uid")
    fun selectByUid(uid:Int):List<AskLeave>


    @Query("select * from ask where uid=:uid order by start desc limit (:page-1)*:size,:page*:size")
    fun selectByIdPage(uid:Int,page:Int,size:Int):List<AskLeave>

    @Query("select count(*) from ask where uid=:uid")
    fun getCount(uid:Int):Int

    /**
     * 查询所有未审核的员工申请的记录
     */
    @Query("select * from ask where status='已提交'")
    fun selectByNoApprove():List<AskLeave>


}